﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Reflection;
using System.Security.Principal;
using System.Text;

namespace Applay
{
    public class AuthorizationContext
    {
        private readonly MethodInfo methodInfo;
        private readonly IPrincipal user;

        public AuthorizationContext(MethodInfo methodInfo, IPrincipal user)
        {
            Contract.Requires(methodInfo != null);
            Contract.Requires(user != null);

            this.methodInfo = methodInfo;
            this.user = user;
            this.IsAuthorized = true;
        }

        public MethodInfo MethodInfo
        {
            get { return this.methodInfo; }
        }

        public IPrincipal User
        {
            get { return this.user; }
        }

        public bool IsAuthorized { get; set; }
    }
}
